import Vue from "vue";
import App from "./App.vue";
import router from "./router";
import "./plugins/element.js";
import "./assets/global.css";
import "./assets/fonts/iconfont.css";
import axios from "axios";
//下拉树
import ZkTable from "vue-table-with-tree-grid";
//时间
import utils from "./libs/utils";
//富文本编辑器
import VueQuillEditor from "vue-quill-editor";
import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css";
//进度条
import NProgress from "nprogress";
import "nprogress/nprogress.css";

axios.defaults.baseURL = "http://www.tangxiaoyang.vip:8888/api/v2/";
axios.interceptors.request.use((config) => {
  //请求发送开始进度条
  NProgress.start();
  const userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
  config.headers.Authorization = userInfo ? userInfo.token : "";
  return config;
});
axios.interceptors.response.use((config) => {
  //响应式结束进度条
  NProgress.done();
  return config;
});
Vue.prototype.$http = axios;
Vue.prototype.$utils = utils;
Vue.component("tree-table", ZkTable);
Vue.config.productionTip = false;
Vue.use(VueQuillEditor);
new Vue({
  router,
  render: (h) => h(App),
}).$mount("#app");
